<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        * {
            word-wrap: break-word;
        }
        
        .wp {
            width: 730px;
            margin: 0px auto;
        }
        
        .mtn {
            margin-top: 5px!important;
        }
        
        #ct .frame {
            margin: 0;
            border: none;
        }
        
        .xfs_2 .frame-title,
        .xfs_2 .frametitle,
        .xfs_2 .tab-title {
            background-color: #A90000;
            background-position: 0 -99px;
        }
        
        .xfs .frame-title,
        .xfs .frametitle,
        .xfs .tab-title,
        .xfs .frame-title a,
        .xfs .frametitle a,
        .xfs .tab-title a {
            color: #FFF!important;
        }
        
        .xfs .frame-title,
        .xfs .frametitle,
        .xfs .tab-title {
            border: none;
            background: transparent url(images/mu.png) repeat-x 0 95;
        }
        
        .title {
            padding: 0 10px;
            height: 32px;
            font-size: 14px;
            font-weight: 700;
            line-height: 32px;
            overflow: hidden;
        }
        
        .block {
            margin: 10px 10px 0;
        }
        
        ul,
        menu,
        dir {
            display: block;
            list-style-type: disc;
            -webkit-margin-before: 1em;
            -webkit-margin-after: 1em;
            -webkit-margin-start: 0px;
            -webkit-margin-end: 0px;
            -webkit-padding-start: 25px;
        }
        
        .mls li {
            padding: 0 0 5px;
            width: 66px;
            height: 85px;
        }
        
        .ml li {
            float: left;
            text-align: center;
            overflow: hidden;
        }
        
        a {
            color: #333;
            text-decoration: none;
            font: 12px/1.5 Tahoma, 'Microsoft Yahei', 'Simsun';
        }
        
        .mls p {
            margin-top: 5px;
        }
        
        .ml p,
        .ml span {
            display: block;
            width: 100%;
            height: 20px;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }
        
        .mls img {
            width: 48px;
            height: 48px;
        }
        
        .ml img {
            display: block;
            margin: 0 auto;
        }
        
        a img {
            border: none;
        }
    </style>
</head>

<body>

    <div class="wp mtn">
        <div id="diy3" class="area">
            <div id="frameipq7f2" class="xfs xfs_2 frame move-span cl frame-1">
                <div class="title frame-title"><span class="titletext">当前在线用户</span></div>
                <div id="frameipq7f2_left" class="column frame-1-c">
                    <div id="frameipq7f2_left_temp" class="move-span temp"></div>
                    <div id="portal_block_695" class="block move-span">
                        <div id="portal_block_695_content" class="dxb_bc">
                            <div class="module cl ml mls" id="users">
                                <ul></ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="common.js"></script>
    <script>
        //模拟从服务器获取数据
        // var users = [
        //     {"icon":"1.jpg", "name":"zs"},
        //     {"icon":"2.jpg", "name":"ls"}
        // ];

        var users = [
            {"name": "tdxy01","icon":"images/bg1.jpg"},
            {"name": "沉眠楚人","icon":"images/bg1.jpg"},
            {"name": "爱上karina","icon":"images/bg2.jpg"},
            {"name": "tdxy01","icon":"images/bg3.jpg"},
            {"name": "today","icon":"images/bg1.jpg"},
            {"name": "hlg","icon":"images/bg1.jpg"},
            {"name": "itcast","icon":"images/bg1.jpg"},
            {"name": "heima","icon":"images/bg1.jpg"},
            {"name": "nima","icon":"images/bg1.jpg"},
            {"name": "gege","icon":"images/bg1.jpg"},
            {"name": "nimei","icon":"images/bg1.jpg"},
            {"name": "goodman","icon":"images/bg1.jpg"},
            {"name": "haoren","icon":"images/bg1.jpg"},
            {"name": "yuanxiaojie","icon":"images/bg1.jpg"},
            {"name": "zhengyue","icon":"images/bg1.jpg"},
            {"name": "qishi","icon":"images/bg1.jpg"},
            {"name": "qqtang","icon":"images/bg1.jpg"},
            {"name": "wawawa","icon":"images/bg1.jpg"},
            {"name": "haha","icon":"images/bg1.jpg"},
            {"name": "robot","icon":"images/bg1.jpg"},
            {"name": "XFlute","icon":"images/bg1.jpg"},
            {"name": "lovmilan","icon":"images/bg1.jpg"},
            {"name": "johnny670","icon":"images/bg1.jpg"},
            {"name": "xiaobinbin02","icon":"images/bg1.jpg"},
            {"name": "axxxxx","icon":"images/bg1.jpg"}
        ];

        //
        var div = my$("users");
        //获取div中的ul，存放用户对应的li
        var ul = getFirstElement(div);

        //遍历所有的用户
        var array = [];
        for (var i = 0; i< users.length; i++) {
            var user = users[i];

            //拼接每一个user对应的li标签
            var str = '<li>' +
                    '<a href="#" target="_blank"><img src="' + user.icon + '" width="48" height="48" alt="' + user.name + '"></a>' +
                    '<p><a href="#" title="' + user.name + '" target="_blank">'+  user.name +'</a></p>' +
                    '</li>';

            array.push(str);
        }
        ul.innerHTML = array.join("");

        // <li>
        // <a href="#" target="_blank"><img src="images/bg1.jpg" width="48" height="48" alt="tdxy01"></a>
        //         <p><a href="#" title="tdxy01" target="_blank">tdxy01</a></p>
        // </li>
    </script>
</body>

</html>